<template>
  <dt-modal-edit ref='edit' :title='title' :label-width='130' :width='500' @ok='onOk'>
  </dt-modal-edit>
</template>

<script>
import incentiveSbumitOpt from '../opt/incentiveSbumit.js'

import incentiveMgr from '@/biz/bonus/incentive'
export default {
  props: ['detailsData'],
  data() {
    return {
      info: {
        bonusMonth: '',
        headerMoney: '',
        oaNumber: null,
        remark: '',
        accessoryBOList: [],

        // person: '',
        // housePro: '',
        // houseName: '',
        // payable: '',
      },
      title: '在销激励提交',
    }
  },
  mounted() {},
  watch: {
    detailsData(val) {
      this.detailsData = val
      console.log(this.detailsData, 'watch')
      this.info.bonusMonth = this.detailsData.bonusMonth
      this.info.headerMoney = this.detailsData.headerMoney
    },
  },
  methods: {
    create() {
      this.$refs.edit.show(incentiveSbumitOpt.options(this), this.info)
    },
    hide() {
      this.$refs.edit.hide()
    },
    onOk() {
      console.log(this.info, 'this.info')
      // initiateMgr.create(this.info).then((res) => {
      //   this.$emit('success', res)
      //   this.hide()
      // })
      let params = {
        headerId: this.$route.query.headerId,
        oaNumber: this.info.oaNumber,
        remark: this.info.remark,
        accessoryBOList: this.info.accessoryBOList,
      }

      incentiveMgr.submitBonusStimulate(params).then((res) => {
        this.$Message.success('提交成功。')
        this.$emit('success')
        this.hide()
      })
    },
  },
}
</script>

<style>
</style>
